package jp.co.cos.ittrick.channel.controller;

import java.util.List;

import jp.co.cos.ittrick.channel.Constants;
import jp.co.cos.ittrick.channel.model.ApplicationModel;
import jp.co.cos.ittrick.channel.model.PageModel;
import jp.co.cos.ittrick.channel.service.ApplicationService;
import jp.co.cos.ittrick.channel.service.PageService;

import org.slim3.controller.Controller;
import org.slim3.controller.Navigation;

public class RssController extends Controller {

    private ApplicationService applicationService;
    private PageService pageService;

    public RssController() {
        applicationService = new ApplicationService();
        pageService = new PageService();
    }

    @Override
    public Navigation run() throws Exception {

        ApplicationModel applicationModel = applicationService.getApplicationModel();
        requestScope("applicationModel", applicationModel);

        List<PageModel> pageList = pageService.getPageListOfLimit(0, Constants.RSS_LIST_LIMIT);
        requestScope("pageList", pageList);

        return forward("rss.jsp");
    }
}
